home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / Developer University / DUProjects / Sample2 / Sources / Frame.cpp < prev    next >
Encoding:
Text File  |  1996-02-15  |  2.1 KB  |  77 lines  |  [TEXT/CWIE]

  1. //    Copyright © 1995 Apple Computer, Inc. All rights reserved.
  2. //    Release Version:    $ 1.0 d11 $
  3.  
  4. //=======================================================================
  5. #ifndef FRAME_H
  6. #include "Frame.h"
  7. #endif
  8.  
  9. #ifndef PART_H
  10. #include "Part.h"
  11. #endif
  12.  
  13. // ----- Framework Layer -----
  14. #ifndef FWUTIL_H
  15. #include "FWUtil.h"                // FW_CFacetContext, FW_Beep()
  16. #endif
  17.  
  18. #ifndef FWCONTXT_H
  19. #include "FWContxt.h"            // FW_CViewContext
  20. #endif
  21.  
  22. // ----- Graphic Includes -----
  23. #ifndef FWRECT_H
  24. #include <FWRect.h>                // FW_CRect
  25. #endif
  26.  
  27. #ifndef FWRECSHP_H
  28. #include "FWRecShp.h"            // FW_CRectShape
  29. #endif
  30.  
  31. #ifndef SOM_DevUniv_STalker_xh
  32. #include "STalker.xh"            // for STalker
  33. #endif 
  34.  
  35. //========================================================================================
  36. #ifdef FW_BUILD_MAC
  37. #pragma segment Sample2
  38. #endif
  39.  
  40. //========================================================================================
  41. FW_DEFINE_AUTO(CSample2Frame)
  42.  
  43. const FW_Boolean kWaitUntilDone = TRUE;    // don't return until talking is finished.
  44.  
  45. //========================================================================================
  46. CSample2Frame::CSample2Frame(Environment* ev, ODFrame* odFrame, 
  47.                                     FW_CPresentation* presentation, CSample2Part* sample2Part)
  48.   : FW_CFrame(ev, odFrame, presentation, sample2Part),
  49.       fSOMTalker(NULL)
  50. {
  51. #ifdef FW_BUILD_MAC                    // can we do text-to-speech on Windows?
  52.     fSOMTalker = new DevUniv_STalker;    
  53.     fSOMTalker->SayString(ev, "I use ODF", !kWaitUntilDone);    // say it!
  54. #endif
  55.     FW_END_CONSTRUCTOR
  56. }
  57.  
  58. //----------------------------------------------------------------------------------------
  59. CSample2Frame::~CSample2Frame()
  60. {
  61.     FW_START_DESTRUCTOR
  62.     delete fSOMTalker;
  63. }
  64.  
  65. //----------------------------------------------------------------------------------------
  66. void 
  67. CSample2Frame::Draw(Environment *ev, ODFacet* odFacet, ODShape* invalidShape)    // Override
  68. {
  69.     FW_CViewContext context(ev, this, odFacet, invalidShape);
  70.     FW_CRect frameRect = this->GetBounds(ev);
  71.  
  72.     // fill frame with green  
  73.     FW_CRectShape rectShape(frameRect, FW_kFill);
  74.     rectShape.GetInk().SetForeColor(FW_kRGBGreen);
  75.     rectShape.Render(context);
  76. }
  77.